import React from 'react';
import Home from './pages/Home'
import About from "./pages/About";
import {NavLink,Navigate,useRoutes} from "react-router-dom";
function App(props) {

    const elements=useRoutes([
        {
            path:'/about',
            element:<About/>
        },
        {
            path:'/home',
            element:<Home/>
        },
        {
            path:'/',
            element:<Navigate to='/about'/>
        },
    ])

    return (
        <div>
            <div className="row">
                <div className="col-xs-offset-2 col-xs-8">
                    <div className="page-header"><h2>React Router Demo</h2></div>
                </div>
            </div>
            <div className="row">
                <div className="col-xs-2 col-xs-offset-2">
                    <div className="list-group">
                        <NavLink to="/about" className="list-group-item " >About</NavLink>
                        <NavLink to="/home" className="list-group-item" >Home</NavLink>
                    </div>
                </div>
                {elements}
            </div>
        </div>
    );
}

export default App;